Content based barcode printing inserts a barcode in the printed document based on the printed document content. Using regular expression, printed text is parsed and only relevant targeted information extracted from a given document, such as account number, invoice number, pricing, etc. See examples below.
Select the Barcode tab ( Start > Control Panel > Printers and Devices > right click on the Black Ice Printer Drivers X1 then click on the Printing Preferences and click on the Barcode tab ) then one can configure the value of the printed barcode by Extract Text (Using Regular Expression parser).
Extract Text (or Regular Expression parser)
If the User selects this option, the Printer Driver X1 will use the text from the printed page as the value of the barcode. However, to extract only specific data from the printed page to be used as the value of the Barcode, one needs to create a Regular Expression configuration file.
To extract only specific data from the printed page to the barcode, one can use a Regular Expression. The Regular Expression is a specific pattern that provides flexible means to "match" (specify and recognize) strings of text, such as words, particular characters or patterns of characters. Common abbreviations for "regular expression" include regex and regexp.
The location of the regexp.txt and regexpformat.txt sample files are:
On every system, the files are located in the directory pointed to by the %ALLUSERSPROFILE% environment variable.
The environment variable points to the “C:\Documents and Settings\All Users” directory on old systems, and to “C:\ProgramData\” on newer systems.
On old systems (Windows XP Windows Server 2003)
C:\Documents and Settings\All Users\Black Ice Software LLC\regexp.txt
C:\Documents and Settings\All Users\Black Ice Software LLC\regexpformat.txt
On new systems (Windows 8/7/Vista and Windows Server 2022/2019/2016/2012)
C:\ProgramData\Black Ice Software LLC\regexp.txt
C:\ProgramData\Black Ice Software LLC\regexpformat.txt
The file name and the location can be changed in the Printer Driver X1 INI file or by clicking the Options button next to the Extract Text (using Regular Expression parser). If the printer driver does not find the regexp.txt file, the Printer Driver X1 will extract the whole text from the printed document and uses the printed page text as the value of the barcode.
The regexp.txt should contain the regular expression to extract the data from the printed text. The regexpformat.txt contains the declared values to format the extracted data, by the regular expression, to be encoded into a barcode.
For Example;
The user can print regular invoices from Microsoft Money Accounting Software. Configure the X1 Printer Driver in the Control Panel > Devices and Printers > X1 Printer Driver Printing Preferences > Barcode tab > Extract text (Using Regular Expression parser), and the print the Invoice from the Microsoft Money.
One can develop content based barcode printing with the Black Ice Regular Expression Test utility
For more information about the Regular Expression for Developers please visit the link.